unit u_pesquisarusuariogrupo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, u_pesquisapadrao, FMTBcd, DB, DBClient, Provider, SqlExpr,
  Grids, DBGrids, StdCtrls, AdvEdit, AdvGlowButton, ExtCtrls, JvExDBGrids,
  JvDBGrid, AdvGroupBox;

type
  TFRM_PesquisaUsuarioGrupo = class(TFRM_PesquisaPadrao)
    cdsPesquisarCOD_GRUPO: TIntegerField;
    cdsPesquisarGRUPO: TStringField;
    cdsPesquisarUSUARIOS: TIntegerField;
    procedure edtPesquisarKeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);

  public
    function PesquisarListaGrupo(Empresa:integer): boolean;
    
  end;

var
  FRM_PesquisaUsuarioGrupo: TFRM_PesquisaUsuarioGrupo;

implementation

uses u_dm_geral;

{$R *.dfm}

{ TFRM_PesquisaUsuarioGrupo }

function TFRM_PesquisaUsuarioGrupo.PesquisarListaGrupo(Empresa: integer): boolean;
begin
  cdsPesquisar.Close;
  sqlPesquisar.Params[0].AsInteger := Empresa;
  cdsPesquisar.Open;
  if cdsPesquisar.IsEmpty then Result := false else Result := true;
end;

procedure TFRM_PesquisaUsuarioGrupo.edtPesquisarKeyPress(Sender: TObject;
  var Key: Char);
begin
  inherited;
  if (edtPesquisar.Text <> '') then cdsPesquisar.Locate('grupo',edtPesquisar.Text + key, [loPartialKey, loCaseInsensitive]);
end;

procedure TFRM_PesquisaUsuarioGrupo.FormShow(Sender: TObject);
begin
  inherited;
  lblTotal.Caption := lblTotal.Caption + ' grupos';
end;

end.
